<?php
require_once WEB_ROOT. '/application/library/Bus.php';

class Bus_Category extends Bus {
    protected $_name = "categorys";
    
    protected function _init() {
        
    }
    
    
    public function delItemWithId($id){
        return $this->delete("idcategorys='{$id}'");
    }
    
    public function getItemById($id){
        $Dtos = $this->select(array(
            'fields' => array(),
            'where'  => "idcategorys='{$id}'"
        ));
        if(count($Dtos) > 0){
            return $Dtos[0];
        }
        return false;
    }
    
    public function checkExist($name) {
        $dto = $this->select(array(
            'fields' =>array(),
            'where'  => "name='{$name}'"
        ));
        if(count($dto) > 0){
            return true;
        }else{
            return false;
        }
    }    
}
?>